import request from '../../util/request'

export default {

  /**分页查询角色
   *
   * @param params 分页查询参数,示例格式: {query:'',pageNum:1,pageSize:3 }
   * @private
   */
  __api__RolesPage:(params)=> {
    return request({
      url: '/roles',
      method: 'get',
      params: params
    })
  },

  /**
   *  添加角色
   * @param params
   * @private
   */
  __api__RolesAdd:(params)=>{
    return request({
      url:'/roles',
      method:'post',
      data:params
    })
  },

  /**
   *  修改角色
   * @param params
   * @private
   */
  __api__RolesUpdate:(params)=>{
    return request({
      url:'/roles',
      method:'put',
      data:params
    })
  },

  /**
   *  删除用户
   * @param params
   * @private
   */
  __api__RolesDelete:(params)=>{
    return request({
      url:'/roles',
      method:'delete',
      data:params
    })
  },


  /**
   *  给角色分配权限
   * @param params
   * @private
   */
  __api__RolesPrivilegesUpdate:(params)=>{
    return request({
      url:'/roles',
      method:'patch',
      data:params
    })
  },


  /**
   * 获取所有角色
   * @private
   */
  __api__RolesAll:()=>{
    return request({
      url:'/roles/all',
      method:'get'
    })
  },

  /**
   *  获取角色的所有权限ID列表
   * @param roleId
   * @private
   */
  __api__RolesPrivilegesIds:(roleId)=>{
    return request({
      url:'/roles/privileges/ids/'+roleId,
      method:'get'
    })
  },

  __api__RolesPrivileges:(roleId)=>{
    return request({
      url: '/roles/privileges/'+roleId,
      method:'get'
    })
  }
}
